<?php

namespace app\model;

class RoleRoutesRelation extends BaseModel
{
    protected $json = [
        'routes_ids',
        'routes_api_ids'
    ];

    protected $append = [
        'all_ids'
    ];

    protected $jsonAssoc = true;

    public function getAllIdsAttr($value, $data){
        return array_merge($data['routes_ids'], array_map(fn($item) => 'a_'.$item, $data['routes_api_ids']));
    }
}